package my.jieh.tips.util.collection;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>Title: Core Java Technologies Tech Tips</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2002</p>
 * <p>Company: Blueimp</p>
 * @author jieh
 * @version 1.0
 */

public class ZeroArrayDemo2 {

  public static void main(String args[]) {

    // set up ArrayList and add strings to it

    List stringlist = new ArrayList();
    stringlist.add("string 1");
    stringlist.add("string 2");
    stringlist.add("string 3");

    // convert to String array

    String out[] = (String[]) stringlist.toArray(new String[0]);
    for (int i = 0; i < out.length; i++) {
      System.out.println(out[i]);
    }
  }

}